//
//  HistoryFaHuoListCell.m
//  FactorySale
//
//  Created by 李 on 2020/1/8.
//  Copyright © 2020 主事丫环. All rights reserved.
//

#import "HistoryFaHuoListCell.h"

@implementation HistoryFaHuoListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.layer.cornerRadius = 8;
    self.clipsToBounds = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(phoneClick:)];
    [self.phoneLab addGestureRecognizer:tap];
    self.phoneLab.userInteractionEnabled = YES;
}

- (void)setFrame:(CGRect)frame{
    frame.origin.x += 15;
    frame.size.width -= 30;
    [super setFrame:frame];
}

-(void)setModel:(UnpaidSendOrderListModel *)model{
    _model = model;
    if (_model) {
        self.timeLab.text = [NSString stringWithFormat:@"%@",_model.create_time];
        self.phoneLab.text = [NSString stringWithFormat:@"%@",_model.phone];
        self.companyNameLab.text = [NSString stringWithFormat:@"%@",_model.name];
        self.diZhiLab.text = [NSString stringWithFormat:@"地址：%@",_model.address];
        if ([_model.order_state isEqualToString:@"1"]) {//1 待收货 2 已收货
            self.stateImageView.image = [UIImage imageNamed:@"待收货"];
        } else {
            self.stateImageView.image = [UIImage imageNamed:@"已收货"];
        }
    }
}

-(void)phoneClick:(UITapGestureRecognizer *)tap{
    if (_model.phone) {
        [HFTools callMobilePhone:_model.phone];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
